<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/public/base.jspf"%>
<!DOCTYPE html>
<html>
<head>
	<title>系统菜单</title>
	<%@include file="/public/base_css.jspf"%>
	<%@include file="/public/base_js.jspf"%>
</head>
<body>
	<table id="tree_grid"></table>
</body>
<script type="text/javascript">
    $('#tree_grid').treegrid({
        url:'loadSuperAdminMenu',
        loadFilter:function(data){
        	return data.obj;
        },
        idField:'id',
        treeField:'text',
        toolbar: [{
			iconCls: 'icon-add',
			text:'添加菜单',
			handler: function(){add();}
		},'-',{
			iconCls: 'icon-edit',
			text: '修改菜单',
			handler: function(){update();}
		},'-',{
			iconCls: 'icon-cancel',
			text: '删除菜单',
			handler: function(){del();}
		}],
        columns:[[{
        	title:'菜单名称',
        	field:'text',
        	width:180
        },{
        	title:'菜单级别',
        	field:'level',
        	width:80,
        	align:'center',
        	formatter:function(value,row){
        		var val = '';
        		switch(value){
        			case 1:val='一级菜单';break;
        			case 2:val='二级菜单';break;
        			case 3:val='三级菜单';break;
        			default:break;
        		}
        		return val;
        	}
        },{
        	title:'URL',
        	field:'url',
        	width:180
        },{
        	title:'类型',
        	field:'type',
        	width:80,
        	align:'center',
        	formatter:function(value,row){
        		var val = '';
        		switch(value){
        			case 1:val='菜单';break;
        			case 2:val='按钮';break;
        			default:break;
        		}
        		return val;
        	}
        },{
        	title:'图标',
        	field:'iconCls',
        	align:'center',
        	width:150
        }]]
    });

    function add(){
		createWindown('editPage/0','添加菜单',320,310);
	}

	function update(){
		createUpdateWindown('tree_grid','editPage','修改类型',320,310);
	}

	function del(){
		createDelDialog('tree_grid','manage','删除','确认删除本条数据吗？');
	}
</script>
</html>